package com.bookshop.utils;

public class StringUtil {
    /**
     * 截取字符串
     *
     * @param subStr 要截取的字符串
     * @param length 截取的字符串长度
     * @return
     */
    public static String sub(String subStr, int length) {
         if(subStr.length()<=length){
             return  subStr;
         }else {
             return  subStr.substring(0,length)+"...";
         }

    }
}
